The Movie Toolbox maintains state information for every application that is currently using the toolbox. The toolbox uses this information to keep track of the application's movies. Before calling any other Movie Toolbox functions, your application must establish this working environment by calling the EnterMovies function. When your application is finished with the Movie Toolbox, you can release this storage by calling the ExitMovies function.
Before you call any Movie Toolbox functions, you must initialize the toolbox. Use the EnterMovies function to initialize the Movie Toolbox. When your application calls this function, the Movie Toolbox creates its private storage area for your application.
You should initialize any other Macintosh managers your application uses before calling the EnterMovies function.
pascal OSErr EnterMovies (void);
If the EnterMovies function fails, it returns an error value--be sure to check the value returned by this function before using any other facilities of the Movie Toolbox.
In addition, you should use the Gestalt Manager to determine whether the Movie Toolbox is installed (see "Determining Whether the Movie Toolbox Is Installed," for more information).
Your application may call the EnterMovies function multiple times for a given A5 world, as long as you balance each invocation of EnterMovies with an invocation of ExitMovies .
The Movie Toolbox identifies an application by the value in the A5 register. If you are writing a stand-alone code resource, you must ensure that A5 is the same whenever you call any Movie Toolbox functions.
Listing 3 provides an example of the EnterMovies function.
QuickTime calls the ExitMovies function automatically when your application quits--you only need to call this function if you finish with the Movie Toolbox long before your application is ready to quit. As a general rule, your application should not use this function.
pascal void ExitMovies (void);
When you call the ExitMovies function, the Movie Toolbox releases the private storage (which may be significant) that was allocated when you called the EnterMovies function, which is described in the previous section.